#include<bits/stdc++.h>
#define int long long 

using namespace std;

signed main() {
	int nn, ret1 = 0;
	cin >> nn;
	int s1 = 0, s2 = 0, s3 = 0, s4 = 0;
	while(nn -- ) {
		int x, y;
		cin >> x >> y;
		if(x > 0 && y > 0 ) {
			s1 ++ ;
		} else if(x < 0 && y > 0 ) {
			s2 ++ ;
		} else if(x < 0 && y < 0) {
			s3 ++ ;
		} else {
			s4 ++ ;
		}		
	}
	int t = min(s1, s3);
	s1 -= t;
	s3 -= t;
	ret1 += t * 2;
	
	int tt = min(s2, s4);
	s2 -= tt;
	s4 -= tt;
	ret1 += tt * 2;
	
	int ss1 = max(s1, s3);
	int ss2 = max(s2, s4);
	ret1 += min(ss2, ss1);
	cout << ret1 << endl;
	return 0;
}
/*
2
1 1
-1 -1


*/

